package org.lmw.note;

import android.graphics.Typeface;

import com.baidu.frontia.Frontia;
import com.baidu.frontia.FrontiaApplication;
import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.exception.DbException;
import com.norbsoft.typefacehelper.TypefaceCollection;
import com.norbsoft.typefacehelper.TypefaceHelper;

public class App extends FrontiaApplication {
	public static DbUtils db;
	public static int s = 20;

	@Override
	public void onCreate() {
		super.onCreate();
		FrontiaApplication.initFrontiaApplication(getApplicationContext());
		Frontia.init(getApplicationContext(), "pdEMVNz1m0km1zrSsuu7p5gs");
		initDB();
		initTTF();
	}

	public void initTTF() {
		TypefaceCollection typeface = new TypefaceCollection.Builder().set(Typeface.NORMAL,
				Typeface.createFromAsset(getAssets(), "fonts/shaonv.ttf")).create();
		TypefaceHelper.init(typeface);
	}

	private void initDB() {
		db = DbUtils.create(this);
		try {
			db.createTableIfNotExist(Note.class);
		} catch (DbException e) {
			e.printStackTrace();
		}
	}

}
